package com.ukao.pad.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import com.ukao.pad.utils.CheckUtils;

/**
 * Created by ukaodev on 2017/5/24.
 */

public class AddClothingItem  extends BaseListBean<AddClothingItem> implements Parcelable,Comparable<AddClothingItem>  {


    /**
     * data : [{"code":"1000","firstWord":"XY","sortNo":1,"name":"洗衣","id":15},{"code":"2000","firstWord":"XX","sortNo":2,"name":"洗鞋","id":16},{"code":"3000","firstWord":"JF","sortNo":3,"name":"家纺","id":17},{"code":"4000","firstWord":"PJHL","sortNo":4,"name":"皮具护理","id":18},{"code":"5000","firstWord":"CL","sortNo":5,"name":"窗帘","id":19},{"code":"6000","firstWord":"FZXG","sortNo":6,"name":"服装修改","id":20}]
     * httpCode : 200
     * msg : 请求成功
     * timestamp : 1499074073734
     */




        /**
         * code : 1000
         * firstWord : XY
         * sortNo : 1
         * name : 洗衣
         * id : 15
         */


        private   int discount;
        private   boolean isCheck;
        private String code;
        private String firstWord;
        private int sortNo;
        private String name;
        private String id="";
        private  int position;
    private  int  saleDiscount;
        private String   unit;
        private String       saleTypeText;
        private String        typeId;
        private int       isCustomNum;
        private String       unitText;
        private int       saleType;
        private String    unitpice;
        private  String  count;
        private  String    TotalServiceDescMoney;
        private  String   selectDesc; /*附件*/
        private  String  count100;
    private int  price;
    private int pages;

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public void setId(String id) {
        this.id = id;
    }

    public AddClothingItem(  ){

    }
    public AddClothingItem(String id,String name) {
        this.name = name;
        this.id = id;
    }
    public String getPrice() {

        return   CheckUtils.isEmptyNumber(price);
    }

    public AddClothingItem(boolean  isCheck){
        this.isCheck=isCheck;
    }
        public String getTotalServiceDescMoney() {
            return TotalServiceDescMoney;
        }

        public void setTotalServiceDescMoney(String totalServiceDescMoney) {
            TotalServiceDescMoney = totalServiceDescMoney;
        }

        public int getDiscount() {
            return saleDiscount;
        }

        public void setDiscount(int discount) {
            this.discount = discount;
        }

        public String getSelectDesc() {
            return selectDesc;
        }

        public void setSelectDesc(String selectDesc) {
            this.selectDesc = selectDesc;
        }



        public String getCount() {
            return count;
        }

        public void setCount(String count) {
            this.count = count;
        }



        public void setUnitText(String unitText) {
            this.unitText = unitText;
        }

        public void setUnitpice(String unitpice) {
            this.unitpice = unitpice;
        }


        public String getCount100() {
            return count100;
        }

        public void setCount100(String count100) {
            this.count100 = count100;
        }

        public String getUnitpice() {
            return unitpice;
        }



        public String getUnit() {
            return unit;
        }

        public String getSaleTypeText() {
            return saleTypeText;
        }

        public String getTypeId() {
            return typeId;
        }

        public int getIsCustomNum() {
            return isCustomNum;   // 衣物里面isCustomNum =1
        }

        public String getUnitText() {
            return unitText; //单位
        }

        public int getSaleType() {
            return saleType;
        }

        private   String  businessId;


        public String getBusinessId() {
            return businessId;
        }

        public String getCode() {
            return code;
        }

        public int getPosition() {
            return position;
        }

        public void setPosition(int position) {
            this.position = position;
        }

        public boolean isCheck() {
            return isCheck;
        }

        public void setCheck(boolean check) {
            isCheck = check;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getFirstWord() {
            return firstWord;
        }

        public void setFirstWord(String firstWord) {
            this.firstWord = firstWord;
        }

        public int getSortNo() {
            return sortNo;
        }

        public void setSortNo(int sortNo) {
            this.sortNo = sortNo;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getId() {
            if(id!=null){
                return id;
            }else {
                return "";
            }
        }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeInt(this.discount);
        dest.writeByte(this.isCheck ? (byte) 1 : (byte) 0);
        dest.writeString(this.code);
        dest.writeString(this.firstWord);
        dest.writeInt(this.sortNo);
        dest.writeString(this.name);
        dest.writeString(this.id);
        dest.writeInt(this.position);
        dest.writeInt(this.saleDiscount);
        dest.writeString(this.unit);
        dest.writeString(this.saleTypeText);
        dest.writeString(this.typeId);
        dest.writeInt(this.isCustomNum);
        dest.writeString(this.unitText);
        dest.writeInt(this.saleType);
        dest.writeString(this.unitpice);
        dest.writeString(this.count);
        dest.writeString(this.TotalServiceDescMoney);
        dest.writeString(this.selectDesc);
        dest.writeString(this.count100);
        dest.writeInt(this.price);
        dest.writeString(this.businessId);
    }

    protected AddClothingItem(Parcel in) {
        super(in);
        this.discount = in.readInt();
        this.isCheck = in.readByte() != 0;
        this.code = in.readString();
        this.firstWord = in.readString();
        this.sortNo = in.readInt();
        this.name = in.readString();
        this.id = in.readString();
        this.position = in.readInt();
        this.saleDiscount = in.readInt();
        this.unit = in.readString();
        this.saleTypeText = in.readString();
        this.typeId = in.readString();
        this.isCustomNum = in.readInt();
        this.unitText = in.readString();
        this.saleType = in.readInt();
        this.unitpice = in.readString();
        this.count = in.readString();
        this.TotalServiceDescMoney = in.readString();
        this.selectDesc = in.readString();
        this.count100 = in.readString();
        this.price = in.readInt();
        this.businessId = in.readString();
    }

    public static final Creator<AddClothingItem> CREATOR = new Creator<AddClothingItem>() {
        @Override
        public AddClothingItem createFromParcel(Parcel source) {
            return new AddClothingItem(source);
        }

        @Override
        public AddClothingItem[] newArray(int size) {
            return new AddClothingItem[size];
        }
    };

    @Override
    public int compareTo(@NonNull AddClothingItem item) {
        return (this.id.compareTo(item.getId()));
    }

    @Override
    public boolean equals(Object obj) {
        AddClothingItem item =  (AddClothingItem)obj;
        return this.id.equals(item.getId());
    }
}
